package com.qf.logistics.service.impl;

import com.qf.logistics.exceptions.MyBaseException;
import com.qf.logistics.exceptions.MyErrorCode;
import com.qf.logistics.mapper.AdminUserMapper;
import com.qf.logistics.pojo.AdminUser;
import com.qf.logistics.service.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.List;

/**
 * created by 赵文韬 on 2022/4/3 15:56
 */
@Service
public class AdminUserServiceImpl implements AdminUserService {
    private AdminUserMapper adminUserMapper;
    @Autowired
    public void setAdminUserMapper(AdminUserMapper adminUserMapper) {
        this.adminUserMapper = adminUserMapper;
    }

    @Override
    public List<AdminUser> findByUserStatus(Long status) {
        Assert.notNull(status,()->{
            throw new MyBaseException(MyErrorCode.PARAM_IS_NULL,"请先传递参数");
        } );
        Assert.isTrue(status==1||status==0, ()->{
            throw new MyBaseException(MyErrorCode.PARAM_IS_FAIL,"传递参数有误" );
        });
        return adminUserMapper.findByStatus(status);
    }
}
